Logging foundation: structured LogEvent, JUL handler, Log API enhancements - #12694
Draft
gnodet wants to merge 1 commit into
Draft
Logging foundation: structured LogEvent, JUL handler, Log API enhancements#12694gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
This was referenced Aug 7, 2026
Add the foundational logging infrastructure for the new build reporting pipeline: - LogEvent API: structured log event with level, message, loggerName, sourceClassName, sourceMethodName, threadId, and instant - MavenSimpleLogger: intercept SLF4J log calls and route them through LogSink for structured capture by ProjectBuildLogAppender - MavenJulHandler: custom JUL handler that bypasses SLF4J when LogSink is available, preserving JUL metadata (sourceClassName, threadId) that SLF4JBridgeHandler discards - Log.trace() and Log.child(): API additions for trace-level logging and hierarchical logger names (parentLogger.childName) - Remove dead logging dependencies: jul-to-slf4j, logback-classic, LogbackConfiguration, Log4j2Configuration — the LogSink pipeline bypasses SLF4J for log capture, making pluggable SLF4J backend shims unnecessary Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
force-pushed
the
feature/logging-foundation
branch
from
August 8, 2026 01:19
bae1db9 to
5a5af1e
Compare
gnodet
added a commit
that referenced
this pull request
Aug 8, 2026
Add a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file (target/build-reports/) at the end of every build. Part 2 of the #12572 split. Builds on the logging foundation from PR #12694 (LogEvent, LogLevel, LogEventSink). New API interfaces: - BuildReport: root report with metadata, modules, failures, problems - BuildStatus: SUCCESS/FAILURE/SKIPPED enum - ModuleReport: per-module results with mojo list - MojoReport: per-mojo execution with captured log events - FailureReport: exception details and stack traces Implementation: - BuildReportCollector: EventSpy that tracks lifecycle events and captures log output via LogEventSink, routing events to mojo/module/build-level buffers using thread-based tracking - BuildReportJsonWriter: zero-dependency JSON serializer - Atomic file writes with timestamped files and latest symlink - Thread-safe for parallel builds (-T) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Focused, reviewable PR that lays the logging infrastructure foundation for the build report feature chain. Each feature has been split into its own PR for focused review and discussion.
What's included
Log API enhancements (
maven-api-core)Log.trace()— 5 overloads +isTraceEnabled()to separate Maven core internals (trace) from user-facing debug output (debug). Maps to SLF4J TRACE / JUL FINEST.Log.child(name)— hierarchical sub-loggers for plugins that want to separate concerns while keeping level control. Default implementation returnsthisfor backward compatibility.Structured LogEvent (
maven-api-core,maven-core)LogEvent/LogLevelAPI for structured log event representationsourceClassName(),sourceMethodName(),threadId()— populated only for events originating fromjava.util.logging,nullfor SLF4J/Log API eventsCustom JUL Handler (
maven-logging)MavenJulHandlerreplacesSLF4JBridgeHandler— reimplements JUL→SLF4J bridging while preserving the fullLogRecordmetadata that the standard bridge silently dropsProjectBuildLogAppenderduring the samepublish()callMavenJulHandler→ SLF4J — all converge on the same structuredLogEventStructured LogSink (
maven-logging,maven-core)MavenSimpleLogger.LogSink— structured callback with(level, loggerName, cleanMessage, formattedMessage, throwable)replacing the oldConsumer<String>sinkProjectBuildLogAppenderproducesLogEventobjects (with JUL metadata when available) instead of raw stringsBuildEventListener.projectLogMessage()now takesLogEventinstead ofStringMojo MDC & logger name (
maven-core)maven.mojo.idMDC key set during mojo execution (format:prefix:goal@executionId)getFullGoalName()("compiler:compile") togetImplementation()(FQCN likeorg.apache.maven.plugins.compiler.CompilerMojo) for proper hierarchical SLF4J level configurationBug fix
DefaultLog.warn(Supplier<String>, Throwable)was callinglogger.info()instead oflogger.warn()PR chain
mvnlogviewerRelated
Test plan
mvn test -pl impl/maven-core,impl/maven-logging— 580 tests pass🤖 Generated with Claude Code